package modified;

public class SimpleBoard {
  private Space[][] spaces;

  public SimpleBoard(int size) {
    spaces = new Space[size][size];

    // Populate the board with empty spaces.
    for(int row = 0; row < spaces.length; row++) {
      for(int col = 0; col < spaces.length; col++) {
        spaces[row][col] = new Space();
      }
    }
  }

  public void moveChecker(Space from, Space to) {
    Checker checkerToMove = from.getChecker();
    from.removeChecker();
    to.placeChecker(checkerToMove);
  }

  public void addChecker(int row, int col, Checker checker) {
    Space destinationSpace = getSpace(row, col);
    destinationSpace.placeChecker(checker);
  }

  public int getSize() {
    return spaces.length;
  }

  // Taken as one-based (not zero-based) coordinates.
  public Space getSpace(int row, int col) {
    return spaces[row-1][col-1];
  }
}
